package com.ruoyi.project.cms.knowledgemanagement.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.cms.knowledgemanagement.domain.KnowledgeHard;
import com.ruoyi.project.cms.knowledgemanagement.service.IKnowledgeBenchmarkingService;
import com.ruoyi.project.cms.knowledgemanagement.service.IKnowledgeHardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Controller
@RequestMapping("/knowledgemanagement/knowledgeHard")
public class KnowledgeHardController extends BaseController {
    @Autowired
    private IKnowledgeHardService iKnowledgeHardService;
    @Autowired
    private IKnowledgeBenchmarkingService iKnowledgeBenchmarkingService;


    String prefix="/cms/knowledgemanagement";

    @GetMapping("")
    public String knowledge(){
        return prefix+"/hard";
    }

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo selectOne(KnowledgeHard knowledgeHard){
        List<KnowledgeHard> list = iKnowledgeHardService.selectOneKnowledegeHard(knowledgeHard);
        return getDataTable(list);
    }


    @GetMapping("/edit")
    public String edit(){
        return prefix+"/edit";
    }

    /*
    * 查看
    * */
    @GetMapping("/detail/{project_id}")
    public String detail(@PathVariable("project_id") Long project_id, ModelMap map){
        map.put("KnowledgeBenchmarking",iKnowledgeBenchmarkingService.selectOneByID(project_id));
        return prefix+"/detail";
    }

}
